package com.example.xata;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;

public class Test {
    public void createData(String dataName) {
        HttpRequest createData = HttpRequest.put("https://api.xata.io/workspaces/workspace_id/dbs/" + dataName);
        createData.header("Authorization", "");
        createData.body("{\n" +
                "  \"branchName\": \"main\",\n" +
                "  \"region\": \"us-east-1\",\n" +
                "  \"metadata\": {\n" +
                "    \"repository\": \"github.com/my/repository\",\n" +
                "    \"branch\": \"github repository\",\n" +
                "    \"stage\": \"testing\",\n" +
                "    \"labels\": [\n" +
                "      \"development\"\n" +
                "    ]\n" +
                "  }\n" +
                "}");
        HttpResponse response = createData.execute();
        System.out.println(response.body());
    }

    public static void main(String[] args) {
        Test test = new Test();
        test.createData("Test");
    }
}
